package com.gy.smart.life.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.gy.smart.R;
import com.gy.smart.life.bean.LifeTypeBean;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.List;

/**
 * Created by 高岳 on 2017/1/9.
 * Describe:生活首页分类
 */
public class LifeHomeTypeAdapter extends BaseAdapter {

    private Context context;
    private List<LifeTypeBean> list;

    public LifeHomeTypeAdapter(Context context,List<LifeTypeBean> list){
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = View.inflate(context, R.layout.adapter_life_home_type,null);
        ImageView imgType = (ImageView) convertView.findViewById(R.id.adapter_life_img_type);
        TextView tvType = (TextView) convertView.findViewById(R.id.adapter_life_tv_type);
        tvType.setText(list.get(position).lc_name);
        ImageLoader.getInstance().displayImage(list.get(position).lc_img_url,imgType);
        return convertView;
    }
}
